$(function() {
	$('#vue_vm_list div').hide();
});

var baseServiceCost = {
	baseServiceCostId: '',
	serviceName: '',
	price: '',
	deductionWay: '',
	deductionValue: '',
	intro: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	remark: '',
};

var view = {
	data: baseServiceCost
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view
});

findAll();

function save() {
	view.data.price = (view.data.price==''? 0: parseFloat(view.data.price));
	view.data.deductionValue = (view.data.deductionValue==''? 0: parseFloat(view.data.deductionValue));

	save_basic(path+'/baseServiceCost/save', {baseServiceCost:view.data}, function() {
		alert('保存成功');
		findAll();
	});
}

function findAll() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();

	findAll_basic(path+'/baseServiceCost/findAll', function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			},
			methods: {
				openEditWindow:function(todo) {
					window.open('1-3-3jcfuwu-1edit.html?pageParam='+encodeURIComponent(JSON.stringify(todo)));
				},
				getHistoryHrefById:function(val) {
					return '1-3-3jcfuwu-2edithistory.html?baseServiceCostId='+val
				}
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function deleteBatch() {
	deleteBatch_basic(path+'/baseServiceCost/deleteBatch');
}
